<template>
  <el-main>
    <el-table
        :data="tableData"
        style="width: 100%">
      <el-table-column
          prop="id"
          label="编号"
          width="180">
      </el-table-column>
      <el-table-column
          prop="name"
          label="名称"
          width="180">
      </el-table-column>
      <el-table-column
          prop="img"
          label="图片">
      </el-table-column>
      <el-table-column
          prop="desc"
          label="介绍">
      </el-table-column>
      <el-table-column
          prop="price"
          label="价格">
      </el-table-column>
      <el-table-column
          prop="sale"
          label="总库存">
      </el-table-column>
      <el-table-column
          prop="occupySale"
          label="占用库存">
      </el-table-column>
      <el-table-column
          prop="surplus"
          label="剩余库存">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
              size="mini"
              @click="handleEdit(scope.$index, scope.row)">加入购物车</el-button>
          </template>
      </el-table-column>
    </el-table>
  </el-main>
</template>

<script>
export default {
name: "list",
  data(){
    return {
      tableData:{},

    }
  },methods:{
    list(){
      this.axios.get("http://localhost:8200/item/list",{}).then(res=>{
        console.log(res);
        this.tableData=res.data.data.list;
      })
    },
    handleEdit(){

    }

  },created() {
    this.list();
  }
}
</script>

<style scoped>

</style>